package com.example.controller;

import com.example.vo.User;
import com.example.common.Rt;
import com.example.service.UserServiceApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhangming
 * @Date 2021/10/8 14:59
 * @Version 1.0
 * @Desc: TODO
 */
@Slf4j
@RequestMapping("/consumer")
@RestController
public class UserController {

	@Autowired
	private UserServiceApi userServiceApi;


	@GetMapping("/rest/{id}")
	public Rt<User> rest(@PathVariable("id") Integer id) {
		return userServiceApi.getByRestTemplate(id);
	}

	@GetMapping("/feign/{id}")
	public Rt<User> feign(@PathVariable("id") Integer id) {
		return userServiceApi.getByFeign(id);
	}

}
